﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MSGGolbalInfo;
using Talk.Common;

namespace TalkServer
{
    public class ReloadAllUser
    {
        public static TCPGolbalInfo.RecordArgs Step01_SendCommandToServerToGetClientData(string section)
        #region >><<
        {
            ActionArgs args1 = new ActionArgs();
            args1.Dest = new MSGGolbalInfo.Target.SectionTarget(section);
            args1.Key1 = Keys.System.Get;
            args1.Key2 = Keys.System.Client;

            TCPGolbalInfo.RecordArgs args2 = new TCPGolbalInfo.RecordArgs(TCPGolbalInfo.FlagEnum.Cmd, args1);
            TASKManager.Instance.Add(args2, args1, Step02_ClientDataOfServer);
            
            return args2;
        }
        #endregion

        public static void Step02_ClientDataOfServer(MSGGolbalInfo.ARGS args)
        #region >><<
        {
            if (args == null) return;
            ActionArgs args1 = args as ActionArgs;
            if (args1 == null) return;

            if (args1.Success)
            {
                List<MSGGolbalInfo.Account> lst1 = args1.Result as List<MSGGolbalInfo.Account>;
                List<GROUP> lst2 = null;
                if (lst1 != null && lst1.Count > 0)
                {
                    UserData.Instance.ServerUser(lst1, out lst2);
                }
                Step02_2_LoadGROUP(lst2);
            }
        }

        protected static void Step02_2_LoadGROUP(List<GROUP> lst)
        {
            if (lst == null || lst.Count == 0) return;



        }
        #endregion

        public static void Step03_SendGroupDataToClient()
        {

        }
    }
}
